# NOT RUN {
## create a demo file using basket format for the example
data <- paste(
  "# this is some test data", 
  "item1, item2", 
  "item1", 
  "item2, item3", 
  sep="\n")
cat(data)
write(data, file = "demo_basket")

## read demo data (skip first line)
tr <- read.transactions("demo_basket", format = "basket", sep=",", skip = 1)
inspect(tr)


## create a demo file using single format for the example
## column 1 contains the transaction ID and column 2 contains one item
data <- paste(
  "trans1 item1", 
  "trans2 item1",
  "trans2 item2", 
  sep ="\n")
cat(data)
write(data, file = "demo_single")

## read demo data
tr <- read.transactions("demo_single", format = "single", cols = c(1,2))
inspect(tr)

## create a demo file using single format with column headers
data <- paste(
  "item_id;trans_id",
  "item1;trans1", 
  "item1;trans2",
  "item2;trans2", 
  sep ="\n")
cat(data)
write(data, file = "demo_single")

## read demo data
tr <- read.transactions("demo_single", format = "single", 
                        header = TRUE, sep = ";", cols = c("trans_id","item_id"))
inspect(tr)

## tidy up
unlink("demo_basket")
unlink("demo_single")
# }
